<?php


/*
* Copyright (c) 2008-2016 vip.com, All Rights Reserved.
*
* Powered by com.vip.osp.osp-idlc-2.5.11.
*
*/

namespace com\vip\tpc\api\model;

class BusinessResultReportRequest {
	
	static $_TSPEC;
	public $carrier_code = null;
	public $transport_no = null;
	public $business_type = null;
	public $business_time = null;
	public $business_code = null;
	public $result_code = null;
	public $result_message = null;
	public $sub_result_code = null;
	
	public function __construct($vals=null){
		
		if (!isset(self::$_TSPEC)){
			
			self::$_TSPEC = array(
			1 => array(
			'var' => 'carrier_code'
			),
			2 => array(
			'var' => 'transport_no'
			),
			3 => array(
			'var' => 'business_type'
			),
			4 => array(
			'var' => 'business_time'
			),
			5 => array(
			'var' => 'business_code'
			),
			6 => array(
			'var' => 'result_code'
			),
			7 => array(
			'var' => 'result_message'
			),
			8 => array(
			'var' => 'sub_result_code'
			),
			
			);
			
		}
		
		if (is_array($vals)){
			
			
			if (isset($vals['carrier_code'])){
				
				$this->carrier_code = $vals['carrier_code'];
			}
			
			
			if (isset($vals['transport_no'])){
				
				$this->transport_no = $vals['transport_no'];
			}
			
			
			if (isset($vals['business_type'])){
				
				$this->business_type = $vals['business_type'];
			}
			
			
			if (isset($vals['business_time'])){
				
				$this->business_time = $vals['business_time'];
			}
			
			
			if (isset($vals['business_code'])){
				
				$this->business_code = $vals['business_code'];
			}
			
			
			if (isset($vals['result_code'])){
				
				$this->result_code = $vals['result_code'];
			}
			
			
			if (isset($vals['result_message'])){
				
				$this->result_message = $vals['result_message'];
			}
			
			
			if (isset($vals['sub_result_code'])){
				
				$this->sub_result_code = $vals['sub_result_code'];
			}
			
			
		}
		
	}
	
	
	public function getName(){
		
		return 'BusinessResultReportRequest';
	}
	
	public function read($input){
		
		$input->readStructBegin();
		while(true){
			
			$schemeField = $input->readFieldBegin();
			if ($schemeField == null) break;
			$needSkip = true;
			
			
			if ("carrier_code" == $schemeField){
				
				$needSkip = false;
				$input->readString($this->carrier_code);
				
			}
			
			
			
			
			if ("transport_no" == $schemeField){
				
				$needSkip = false;
				$input->readString($this->transport_no);
				
			}
			
			
			
			
			if ("business_type" == $schemeField){
				
				$needSkip = false;
				$input->readString($this->business_type);
				
			}
			
			
			
			
			if ("business_time" == $schemeField){
				
				$needSkip = false;
				$input->readI64($this->business_time); 
				
			}
			
			
			
			
			if ("business_code" == $schemeField){
				
				$needSkip = false;
				$input->readString($this->business_code);
				
			}
			
			
			
			
			if ("result_code" == $schemeField){
				
				$needSkip = false;
				$input->readString($this->result_code);
				
			}
			
			
			
			
			if ("result_message" == $schemeField){
				
				$needSkip = false;
				$input->readString($this->result_message);
				
			}
			
			
			
			
			if ("sub_result_code" == $schemeField){
				
				$needSkip = false;
				$input->readString($this->sub_result_code);
				
			}
			
			
			
			if($needSkip){
				
				\Osp\Protocol\ProtocolUtil::skip($input);
			}
			
			$input->readFieldEnd();
		}
		
		$input->readStructEnd();
		
		
		
	}
	
	public function write($output){
		
		$xfer = 0;
		$xfer += $output->writeStructBegin();
		
		$xfer += $output->writeFieldBegin('carrier_code');
		$xfer += $output->writeString($this->carrier_code);
		
		$xfer += $output->writeFieldEnd();
		
		$xfer += $output->writeFieldBegin('transport_no');
		$xfer += $output->writeString($this->transport_no);
		
		$xfer += $output->writeFieldEnd();
		
		$xfer += $output->writeFieldBegin('business_type');
		$xfer += $output->writeString($this->business_type);
		
		$xfer += $output->writeFieldEnd();
		
		if($this->business_time !== null) {
			
			$xfer += $output->writeFieldBegin('business_time');
			$xfer += $output->writeI64($this->business_time);
			
			$xfer += $output->writeFieldEnd();
		}
		
		
		if($this->business_code !== null) {
			
			$xfer += $output->writeFieldBegin('business_code');
			$xfer += $output->writeString($this->business_code);
			
			$xfer += $output->writeFieldEnd();
		}
		
		
		$xfer += $output->writeFieldBegin('result_code');
		$xfer += $output->writeString($this->result_code);
		
		$xfer += $output->writeFieldEnd();
		
		if($this->result_message !== null) {
			
			$xfer += $output->writeFieldBegin('result_message');
			$xfer += $output->writeString($this->result_message);
			
			$xfer += $output->writeFieldEnd();
		}
		
		
		if($this->sub_result_code !== null) {
			
			$xfer += $output->writeFieldBegin('sub_result_code');
			$xfer += $output->writeString($this->sub_result_code);
			
			$xfer += $output->writeFieldEnd();
		}
		
		
		$xfer += $output->writeFieldStop();
		$xfer += $output->writeStructEnd();
		return $xfer;
	}
	
}

?>